package no.zsoft.faktura.admin.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "T_ROLES")
public class UserRole implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ROLE_ID")
	private Long userRoleID;

	@Column(name = "AUTHORITY")
	@Enumerated(EnumType.STRING)
	private Authority authority;

//	@ManyToMany(fetch=FetchType.EAGER,cascade = { CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "roles", targetEntity = User.class)
//	private List<User> users;
	
	public Long getUserRoleID() {
		return userRoleID;
	}

	public void setUserRoleID(Long userRoleID) {
		this.userRoleID = userRoleID;
	}

	public Authority getAuthority() {
		return authority;
	}

	public void setAuthority(Authority authority) {
		this.authority = authority;
	}

	@Override
	public String toString() {
		return authority.name();
	}

}
